package com.cn.newetv.content;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class EtvSQLiteOpenHelper extends SQLiteOpenHelper {
	public final static int VERSION = 1;
	
	public final static String TN_FAV_LIST = "T_FAV_LIST";
	public final static String TN_FAV_FILM = "T_FAV_FILM";
	public final static String DATABASE_NAME = "etv.db";
	public EtvSQLiteOpenHelper(Context context) {
		super(context, DATABASE_NAME, null, VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE if not exists "+TN_FAV_LIST+" (id integer primary key autoincrement,videoname varchar(256),videotype integer,videodata varchar(256),filmid varchar(16),mode integer,intime varchar(19));");
		db.execSQL("CREATE TABLE if not exists "+TN_FAV_FILM+" (id integer primary key autoincrement,name varchar(256),type varchar(2),pic varchar(256),filmid varchar(16),mode integer,intime varchar(19));");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		System.out.println("--------onUpdate Called--------" 
				+ oldVersion + "--->" + newVersion);
		db.execSQL("DROP TABLE if exists "+TN_FAV_LIST);
		db.execSQL("DROP TABLE if exists "+TN_FAV_FILM);
		onCreate(db);
	}

}
